import jsonp from 'common/js/jsonp'
import {commonParams, options, ERR_OK} from './config'

export function getHotKey() {
//   const url = 'https://c.y.qq.com/splcloud/fcgi-bin/gethotkey.fcg'

//   const data = Object.assign({}, commonParams, {
//     uin: 0,
//     needNewCode: 1,
//     platform: 'h5'
//   })

//   return jsonp(url, data, options)
    return new Promise((resolved,rejected)=>{
        setTimeout(() => {
            resolved(
                {"code":0,"data":{"hotkey":[{"k":"我们的歌 ","n":765562},{"k":"冰雪奇缘2 ","n":587404},{"k":"张杰 ","n":323823},{"k":"桥边姑娘 ","n":287637},{"k":"星辰大海 ","n":202868},{"k":"哪咤 李宇春 ","n":192652},{"k":"左手指月 ","n":164609},{"k":"邓紫棋 ","n":155475},{"k":"酒醉的蝴蝶 ","n":154236},{"k":"左肩 ","n":139814},{"k":"从前有座灵剑山 ","n":133861},{"k":"下山 ","n":122423},{"k":"肖战 ","n":107837},{"k":"DANCE MONKEY ","n":103401},{"k":"句号 ","n":76584},{"k":"冰雪奇缘 ","n":76530},{"k":"心似烟火 ","n":69945},{"k":"酒醉的蝴蝶原唱 ","n":69664},{"k":"句号邓紫棋 ","n":68767},{"k":"IU ","n":67439},{"k":"星星 ","n":63065},{"k":"谁不渴望有人懂 ","n":58028},{"k":"欧若拉 ","n":56138},{"k":"时代少年团 ","n":55243},{"k":"这就是爱情 ","n":54667},{"k":"傻女 ","n":54231},{"k":"KARA ","n":52715},{"k":"跟着感觉走 ","n":51699},{"k":"具荷拉 ","n":51531},{"k":"LET IT GO ","n":45000}],"special_key":"Gai见面吧电台","special_url":"http://y.qq.com/m/act/hiradio/27.html"},"subcode":0}
            )
        }, 500);
    })
}

export function search(query, page, zhida, perpage) {
//   const url = 'https://c.y.qq.com/soso/fcgi-bin/search_for_qq_cp'

//   const data = Object.assign({}, commonParams, {
//     w: query,
//     p: page,
//     perpage,
//     n: perpage,
//     catZhida: zhida ? 1 : 0,
//     zhidaqu: 1,
//     t: 0,
//     flag: 1,
//     ie: 'utf-8',
//     sem: 1,
//     aggr: 0,
//     remoteplace: 'txt.mqq.all',
//     uin: 0,
//     needNewCode: 1,
//     platform: 'h5'
//   })

//   return jsonp(url, data, options)

  return new Promise((resolved,rejected)=>{
        setTimeout(() => {
            resolved(
                {
                    code:ERR_OK,
                    data:{
                        zhida:{
                            singerid:'11',
                            singername:'专辑列表',
                            name:'张靓颖'
                        },
                        song:{
                            totalnum:3,
                            curnum:1,
                            curpage:1,
                            list:[{
                                    songid:1,
                                    albummid:1,
                                    songmid:'5062',
                                    singer:['薛之谦','张小飞'],
                                    songname:'光芒',
                                    albumname:'张靓颖',
                                    interval:3400
                                },
                                {
                                    songid:2,
                                    albummid:2,
                                    songmid:'-1',
                                    singer:['薛之谦','张小飞'],
                                    songname:'江南',
                                    albumname:'林俊杰',
                                    interval:3400
                                },
                                {
                                    songid:3,
                                    albummid:3,
                                    songmid:'5064',
                                    singer:['薛之谦','张小飞'],
                                    songname:'改变自己',
                                    albumname:'王力宏',
                                    interval:3400
                                }]
                        } 
                    }
                }
            )
        }, 1000);
    })
}
